package helper.form.inputs;

import java.util.LinkedList;

public class SelectInput extends BasicInput {

	protected LinkedList<Option> option;
	
	
	public SelectInput(String name,String label) {
		super(name,label);
	}
	
	
	public SelectInput(String name,String label, String cssClass) {
		this(name,label);
		this.cssClass=cssClass;
	}
	
	public SelectInput(String name,String label, String cssClass, String otherHtml) {
		this(name,label,cssClass);
		this.otherHtml=otherHtml;
	}
	
	
	
	
	public void addOption(LinkedList<Option> option) {
		this.option = option;
	}


	@Override
	public String render() {
		String output = this.renderLabel();
		output="<select \" name=\""+this.name+"\"";
		
		if(!this.cssClass.isEmpty()) {
			output+="class =\""+this.cssClass+"\"";
		}
		if(!this.otherHtml.isEmpty()) {
			output+=this.otherHtml;
		}
		
		output+=" />\n";
		
		for(Option o : this.option) {
			output+=o.render();
		}

		output+="</select>\n";
		return output;
	}

}
